package com.example.mydemoproject.model;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @author LiuZhiYong
 * @description
 * @date 2022-09-22
 **/
@Component
@Slf4j
public class Test implements ApplicationContextAware, CommandLineRunner {

    private final TransferConfiguration transferConfiguration;

    public Test(TransferConfiguration transferConfiguration) {
        this.transferConfiguration = transferConfiguration;
    }

    @PostConstruct
    public void init() {
        log.info("PostConstructInit:{}", this.transferConfiguration);
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        log.info("Aware:{}", this.transferConfiguration);
    }

    @Override
    public void run(String... args) throws Exception {
        log.info("runner:{}", this.transferConfiguration);
    }
}
